home *** CD-ROM | disk | FTP | other *** search
- head 1.5;
- branch ;
- access ;
- symbols ;
- locks hyc:1.5; strict;
- comment @ * @;
-
-
- 1.5
- date 88.06.01.19.17.40; author hyc; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 88.06.01.15.19.21; author hyc; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.06.01.15.16.46; author hyc; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.04.11.17.51.28; author hyc; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.04.11.17.50.00; author hyc; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.5
- log
- @Change compilation conditionals
- @
- text
- @/*
- * $Header: arccvt.c,v 1.4 88/06/01 15:19:21 hyc Locked $
- */
-
- /*
- * ARC - Archive utility - ARCCVT
- *
- * Version 1.16, created on 02/03/86 at 22:53:02
- *
- * (C) COPYRIGHT 1985 by System Enhancement Associates; ALL RIGHTS RESERVED
- *
- * By: Thom Henderson
- *
- * Description: This file contains the routines used to convert archives to use
- * newer file storage methods.
- *
- * Language: Computer Innovations Optimizing C86
- */
- #include <stdio.h>
- #include "arc.h"
-
- void openarc(), rempath(), closearc(), abort(), pack(), writehdr(), filecopy();
- int match(), readhdr(), unpack(), unlink();
-
- static char tempname[STRLEN]; /* temp file name */
-
- void
- cvtarc(num, arg) /* convert archive */
- int num; /* number of arguments */
- char *arg[]; /* pointers to arguments */
- {
- struct heads hdr; /* file header */
- int cvt; /* true to convert current file */
- int did[MAXARG];/* true when argument was used */
- int n; /* index */
- char *makefnam(); /* filename fixer */
- FILE *fopen();/* file opener */
- void cvtfile();
-
- if (arctemp) /* use temp area if specified */
- sprintf(tempname, "%s.CVT", arctemp);
- else
- makefnam("$ARCTEMP.CVT", arcname, tempname);
- #if !DOS
- image = 1;
- #endif
-
- openarc(1); /* open archive for changes */
-
- for (n = 0; n < num; n++) /* for each argument */
- did[n] = 0; /* reset usage flag */
- rempath(num, arg); /* strip off paths */
-
- if (num) { /* if files were named */
- while (readhdr(&hdr, arc)) { /* while more files to check */
- cvt = 0;/* reset convert flag */
- for (n = 0; n < num; n++) { /* for each template
- * given */
- if (match(hdr.name, arg[n])) {
- cvt = 1; /* turn on convert flag */
- did[n] = 1; /* turn on usage flag */
- break; /* stop looking */
- }
- }
-
- if (cvt)/* if converting this one */
- cvtfile(&hdr); /* then do it */
- else { /* else just copy it */
- writehdr(&hdr, new);
- filecopy(arc, new, hdr.size);
- }
- }
- } else
- while (readhdr(&hdr, arc)) /* else convert all files */
- cvtfile(&hdr);
-
- hdrver = 0; /* archive EOF type */
- writehdr(&hdr, new); /* write out our end marker */
- closearc(1); /* close archive after changes */
-
- if (note) {
- for (n = 0; n < num; n++) { /* report unused args */
- if (!did[n]) {
- printf("File not found: %s\n", arg[n]);
- nerrs++;
- }
- }
- }
- }
-
- void
- cvtfile(hdr) /* convert a file */
- struct heads *hdr; /* pointer to header data */
- {
- long starts, ftell(); /* where the file goes */
- FILE *tmp, *fopen(); /* temporary file */
-
- if (!(tmp = fopen(tempname, "w+b")))
- abort("Unable to create temporary file %s", tempname);
-
- if (note) {
- printf("Converting file: %-12s reading, ", hdr->name);
- fflush(stdout);
- }
- unpack(arc, tmp, hdr); /* unpack the entry */
- fseek(tmp, 0L, 0); /* reset temp for reading */
-
- starts = ftell(new); /* note where header goes */
- hdrver = ARCVER; /* anything but end marker */
- writehdr(hdr, new); /* write out header skeleton */
- pack(tmp, new, hdr); /* pack file into archive */
- fseek(new, starts, 0); /* move back to header skeleton */
- writehdr(hdr, new); /* write out real header */
- fseek(new, hdr->size, 1); /* skip over data to next header */
- fclose(tmp); /* all done with the file */
- if (unlink(tempname) && warn) {
- printf("Cannot unsave %s\n", tempname);
- nerrs++;
- }
- }
- @
-
-
- 1.4
- log
- @Removed unused MTS code...
- @
- text
- @d2 1
- a2 1
- * $Header: arccvt.c,v 1.3 88/06/01 15:16:46 hyc Locked $
- d44 1
- a44 1
- #ifndef DOS
- @
-
-
- 1.3
- log
- @Fixed declarations
- @
- text
- @d2 1
- a2 1
- * $Header: arccvt.c,v 1.4 88/04/19 01:39:28 hyc Exp $
- d44 1
- a44 1
- #ifndef MSDOS
- a96 4
- /*
- #ifdef MTS
- char name[16];
- #endif */
- a97 1
- #ifdef MTS
- a98 3
- #else
- if (!(tmp = fopen(tempname, "w+")))
- #endif
- a104 6
- /*
- #ifdef MTS
- strcpy(name, hdr->name);
- fseek(tmp, 0, 0);
- #endif
- */
- a112 5
- /*
- #ifdef MTS
- strcpy(hdr->name, name);
- #endif
- */
- @
-
-
- 1.2
- log
- @re-synch wuth MTS, minor formatting
- @
- text
- @d2 1
- a2 12
- * $Log: arccvt.c,v $
- * Revision 1.1 88/04/11 17:50:00 hyc
- * Initial revision
- *
- * Revision 1.1 87/12/19 04:02:03 hyc
- * Initial revision
- *
- * Revision 1.3 87/08/13 17:03:07 hyc
- * Run thru the indent program...
- * Revision 1.2 87/07/21 06:57:53 hyc *** empty
- * log message ***
- *
- d22 2
- a23 1
- static char tempname[100]; /* temp file name */
- d25 3
- a27 1
- INT
- d29 1
- a29 1
- INT num; /* number of arguments */
- d33 3
- a35 3
- INT cvt; /* true to convert current file */
- INT did[25];/* true when argument was used */
- INT n; /* index */
- d38 1
- a38 1
- INT cvtfile();
- d44 1
- a44 1
- #ifdef MTS
- d91 1
- a91 1
- INT
- d95 1
- a95 1
- LONG starts, ftell(); /* where the file goes */
- d97 1
- d100 1
- a100 1
- #endif
- d113 1
- d118 1
- d123 1
- a123 1
- hdrver = 8; /* anything but end marker */
- d127 1
- d131 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d3 3
- d65 1
- a65 1
- for (n = 0; n < num; n++) { /* for each template *
- d99 1
- a99 1
- static INT
- @
-